package v1

import (
	"github.com/gogf/gf/v2/frame/g"
	"star/internal/model"
)

// 用户注册

type RegisterReq struct {
	g.Meta   `path:"users/register" method:"post" sm:"用户注册" tags:"用户"`
	Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
	Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
	Email    string `json:"email" v:"required#邮箱不能为空" dc:"邮箱"`
}
type RegisterRes struct {
	Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
	Email    string `json:"email" v:"required#邮箱不能为空" dc:"邮箱"`
}

// 用户登录

type LoginReq struct {
	g.Meta   `path:"users/login" method:"post" sm:"用户登录" tags:"用户"`
	Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
	Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
}
type LoginRes struct {
	Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
	Email    string `json:"email" v:"required#邮箱不能为空" dc:"邮箱"`
	Token    string `json:"token" dc:"在需要鉴权的接口中header加入Authorization: token"`
}

// 获取用户列表

type UserListReq struct {
	g.Meta   `path:"users/list" method:"get" sm:"获取用户列表" tags:"用户"`
	Username string `json:"username"  dc:"用户名"`
	Page     int    `json:"page" dc:"页码"`
	Size     int    `json:"size" dc:"每页数量"`
}
type UserListRes struct {
	Total int              `json:"total"`
	List  []model.UserItem `json:"list"`
}
